
symbol_price_sort = [('SR109.CZCE', 5352.0), ('SR105.CZCE', 5272.0), ('SR107.CZCE', 5316.0), ('SR201.CZCE', 5506.0)]
contract_id_list = []
contract_price_dict = {}
for contract_id, contract_price in symbol_price_sort:
    contract_id_list.append(contract_id)
    contract_price_dict[contract_id] = contract_price
contract_id_list = sorted(contract_id_list, reverse=False)

date_delta_dict = {}
price_dict = {}
first_price = contract_price_dict[contract_id_list[0]]   # 第1个值
last_price = first_price    # 上一个值
first_month = 0
direction_flag = True
last_direction = 0
for contract_id in contract_id_list:
    contract_price = contract_price_dict[contract_id]
    symbol_id, _ = contract_id.split(".")
    symbol_month = int(symbol_id[-2:])
    if first_month == 0:
        # 第1个值
        date_delta_dict[contract_id] = 0
        first_month = symbol_month
    else:
        month_gap = symbol_month - first_month
        if month_gap < 0:
            month_gap += 12
        date_delta_dict[contract_id] = month_gap
        # 判断绝对方向是否一致
        direction = 1 if contract_price > last_price else -1
        if contract_price == last_price:
            direction = last_direction
        if direction != last_direction and last_direction != 0:
            direction_flag = False
        last_direction = direction
        last_price = contract_price
if direction_flag:
    # 绝对方向不一致的，直接不入选
    print("True")
else:
    print(f"False")